home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / mimelib / message.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-05-14  |  5.4 KB  |  131 lines

  1. //=============================================================================
  2. // File:       message.h
  3. // Contents:   Declarations for DwMessage
  4. // Maintainer: Doug Sauder <dwsauder@fwb.gulf.net>
  5. // WWW:        http://www.fwb.gulf.net/~dwsauder/mimepp.html
  6. //
  7. // Copyright (c) 1996, 1997 Douglas W. Sauder
  8. // All rights reserved.
  9. //
  10. // IN NO EVENT SHALL DOUGLAS W. SAUDER BE LIABLE TO ANY PARTY FOR DIRECT,
  11. // INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
  12. // THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF DOUGLAS W. SAUDER
  13. // HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. //
  15. // DOUGLAS W. SAUDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT
  16. // NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  17. // PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
  18. // BASIS, AND DOUGLAS W. SAUDER HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
  19. // SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  20. //
  21. //=============================================================================
  22.  
  23. #ifndef DW_MESSAGE_H
  24. #define DW_MESSAGE_H
  25.  
  26. #ifndef DW_CONFIG_H
  27. #include <mimelib/config.h>
  28. #endif
  29.  
  30. #ifndef DW_ENTITY_H
  31. #include <mimelib/entity.h>
  32. #endif
  33.  
  34. //=============================================================================
  35. //+ Name DwMessage -- Class representing an RFC-822/MIME message
  36. //+ Description
  37. //. {\tt DwMessage} represents an RFC-822/MIME {\it message}.
  38. //.
  39. //. A {\it message} contains both a collection of {\it header fields} and
  40. //. a {\it body}. In the terminology of RFC-2045, the general term for the
  41. //. headers-body combination is {\it entity}. In MIME++, {\tt DwMessage}
  42. //. is a direct subclass of {\tt DwEntity}, and therefore contains both
  43. //. a {\tt DwHeaders} object and a {\tt DwBody} object.
  44. //.
  45. //. In the tree (broken-down) representation of message, a {\tt DwMessage}
  46. //. object is almost always a root node, having child nodes but no parent node.
  47. //. The child nodes are the {\tt DwHeaders} object and the {\tt DwBody} object
  48. //. it contains.  A {\tt DwMessage} may sometimes be an intermediate node.  In
  49. //. this special case, the parent node is a {\tt DwBody} object of type
  50. //. "message/*" and the {\tt DwMessage} object represents an encapsulated
  51. //. message.
  52. //.
  53. //. To access the contained {\tt DwHeaders} object, use the inherited member
  54. //. function {\tt DwEntity::Headers()}.  To access the contained {\tt DwBody}
  55. //. object, use the inherited member function {\tt DwEntity::Body()}.
  56. //=============================================================================
  57. // Last modified 1997-08-30
  58. //+ Noentry ~DwMessage _PrintDebugInfo
  59.  
  60. class DW_EXPORT DwMessage : public DwEntity {
  61.  
  62. public:
  63.  
  64.     DwMessage();
  65.     DwMessage(const DwMessage& aMessage);
  66.     DwMessage(const DwString& aStr, DwMessageComponent* aParent=0);
  67.     //. The first constructor is the default constructor, which sets the
  68.     //. {\tt DwMessage} object's string representation to the empty string
  69.     //. and sets its parent to {\tt NULL}.
  70.     //.
  71.     //. The second constructor is the copy constructor, which performs
  72.     //. a deep copy of {\tt aMessage}.
  73.     //. The parent of the new {\tt DwMessage} object is set to {\tt NULL}.
  74.     //.
  75.     //. The third constructor copies {\tt aStr} to the {\tt DwMessage}
  76.     //. object's string representation and sets {\tt aParent} as its parent.
  77.     //. The virtual member function {\tt Parse()} should be called immediately
  78.     //. after this constructor in order to parse the string representation.
  79.  
  80.     virtual ~DwMessage();
  81.  
  82.     const DwMessage& operator = (const DwMessage& aMessage);
  83.     //. This is the assignment operator, which performs a deep copy of
  84.     //. {\tt aMessage}.  The parent node of the {\tt DwMessage} object
  85.     //. is not changed.
  86.  
  87.     virtual DwMessageComponent* Clone() const;
  88.     //. This virtual function, inherited from {\tt DwMessageComponent},
  89.     //. creates a new {\tt DwMessage} on the free store that has the same
  90.     //. value as this {\tt DwMessage} object.  The basic idea is that of
  91.     //. a ``virtual copy constructor.''
  92.  
  93.     static DwMessage* NewMessage(const DwString& aStr,
  94.         DwMessageComponent* aParent);
  95.     //. Creates a new {\tt DwMessage} object on the free store.
  96.     //. If the static data member {\tt sNewMessage} is {\tt NULL},
  97.     //. this member function will create a new {\tt DwMessage}
  98.     //. and return it.  Otherwise, {\tt NewMessage()} will call
  99.     //. the user-supplied function pointed to by {\tt sNewMessage},
  100.     //. which is assumed to return an object from a class derived from
  101.     //. {\tt DwMessage}, and return that object.
  102.  
  103.     //+ Var sNewMessage
  104.     static DwMessage* (*sNewMessage)(const DwString&, DwMessageComponent*);
  105.     //. If {\tt sNewMessage} is not {\tt NULL}, it is assumed to point
  106.     //. to a user supplied function that returns an object from a class
  107.     //. derived from  {\tt DwMessage}.
  108.  
  109. private:
  110.  
  111.     static const char* const sClassName;
  112.  
  113. public:
  114.  
  115.     virtual void PrintDebugInfo(std::ostream& aStrm, int aDepth=0) const;
  116.     //. This virtual function, inherited from {\tt DwMessageComponent},
  117.     //. prints debugging information about this object to {\tt aStrm}.
  118.     //. It will also call {\tt PrintDebugInfo()} for any of its child
  119.     //. components down to a level of {\tt aDepth}.
  120.     //.
  121.     //. This member function is available only in the debug version of
  122.     //. the library.
  123.  
  124. protected:
  125.  
  126.     void _PrintDebugInfo(std::ostream& aStrm) const;
  127.  
  128. };
  129.  
  130. #endif
  131.